﻿using System.Collections;
using System.Collections.Generic;
using Entitas;
using UnityEngine;
using Services;

public class GameController : MonoBehaviour
{
    private Systems _systems;
    
    void Start()
    {
        Contexts contexts = Contexts.sharedInstance;
        _systems = GetSystems(contexts);
        new Service(contexts, transform);
        Models.Instance.Init();
        _systems.Initialize();
    }

    public Systems GetSystems(Contexts contexts)
    {
        return new GameFeatures(contexts)
            .Add(new GameEventSystems(contexts))
            .Add(new InputFeatures(contexts));
    }
 
    void Update()
    {
        _systems.Execute();
        _systems.Cleanup();
    }
}
